package dao;

import utils.DB;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class AdminDao {
    public boolean selectByNameAPwd(String name, String password) {
        Connection con = DB.getConnection();
        PreparedStatement ps = null;
        ResultSet rs = null;
        try {
           ps = con.prepareStatement("select * form admin where name=? and password=?");
          ps.setString(1,name);
          ps.setString(2,password);
          ps.executeQuery();
          boolean r;
          if (rs.next()){
              r = true;
          }else {
              r =false;
          }
          rs.close();
          ps.close();
          con.close();
          return r;
        } catch (Exception e) {
            e.printStackTrace();
        }
     return false;
    }

}
